<template>
	<section>		
		<div>				
			<el-col :span="24">
				<h1 style="text-align: center;margin: 20px 0;font-size:18px;">{{tochild.name}}</h1>
				<div :span="24" >
					<h1>教案</h1>
					<el-collapse v-model="activeName" >
						<div v-for="(el,index) in tochild.plans">			
						  <el-collapse-item  v-bind="{'title':el.name,name:index}" >
						    <div v-html="el.content" v-if="!el.path"></div>
							<iframe :src="el.path" v-if="el.path" width="100%" height="600px">
							 This browser does not support PDFs. Please download the PDF to view it: <a href="/test.pdf" rel="external nofollow" >Download PDF</a>
							</iframe>				    
						  </el-collapse-item>
					  </div>
					</el-collapse>				
				</div>
				<el-row :gutter="20" style="margin: 30px 0;">
					<h1>视频</h1>
					<el-col  :span="6" v-for="el in tochild.videos" style="margin-bottom: 10px;" >
					    <el-card  :body-style="{ padding: '0px' }" class="video-box">
					      <div class="video-imgbox">
							<video width="100%"  v-bind:src="el.path" height="" controls>
							</video>
					      </div>
					      <div style="padding: 14px;">
					        <span>{{el.name}}</span>
					        <div class="bottom clearfix">
					        </div>
					      </div>
					    </el-card>
					</el-col>			
				</el-row>	
				<el-row :gutter="20" style="margin: 30px 0;" v-if="tochild.courseStage==1">
					<h1 >图纸</h1>
					<el-col  :span="6" v-for="el in tochild.drawings" style="margin-bottom: 10px;">
						<div class="coursetags" v-on:click="showDislog(el)">
							<el-tag type="success" >{{el.name}}</el-tag>						
						</div>
					</el-col>			
				</el-row>		
				<el-row :gutter="20" style="margin: 30px 0;">
					<h1 >作业</h1>
					<el-col  :span="24" v-for="el in tochild.problems" style="margin-bottom: 10px;">
						<div v-if="el.type==1">
							<el-form ref="el" :model="el" label-width="80px">
								<el-form-item  label="问题:">
									{{el.question}}<span style="color: red;float: right;">(满分{{el.score}}分)</span>
								</el-form-item>
							</el-form>
							<el-form ref="el" :model="el" label-width="80px">
								<el-form-item  label="回答:">
									<el-input v-model="el.answer" :disabled="role!='student'||stupass"  type="textarea"></el-input>
								</el-form-item>
							</el-form>	
							<el-form v-if="scoreShow">
								<el-form-item  label="本题得分：" label-width="120px" style="color: red;">
									{{el.problemScore}}分
								</el-form-item>		
								<el-form-item  v-if="scoreShow" label="评语：" label-width="120px" style="color: red;">
									{{el.remark}}
								</el-form-item>									
							</el-form>
						</div>
						<div v-if="el.type==2">
							<el-form ref="el" :model="el" label-width="80px">
								<el-form-item  label="问题:">
									{{el.question}}<span style="color: red;float: right;">(满分{{el.score}}分)</span>
								</el-form-item>
								<el-form-item ref="el" label="回答:" :model="el" >
								    <el-radio-group v-model="el.correctAnswer" :disabled="role!='student'||stupass" >
								      <el-radio label="A">{{el.optionA}}</el-radio></br></br>
								      <el-radio label="B">{{el.optionB}}</el-radio></br></br>
								      <el-radio label="C">{{el.optionC}}</el-radio></br></br>
								      <el-radio label="D">{{el.optionD}}</el-radio></br></br>
								      <el-radio v-if="el.optionE" label="E">{{el.optionE}}</el-radio></br></br>
								      <el-radio v-if="el.optionF" label="F">{{el.optionF}}</el-radio>
								    </el-radio-group>
								</el-form-item>	
								<el-form-item v-if="scoreShow"  label="本题得分：" label-width="120px" style="color: red;">
									{{el.problemScore}}分
								</el-form-item>		
								<el-form-item v-if="scoreShow" label="正确答案：" label-width="120px" style="color: red;">
									{{el.correctAnswer}}
								</el-form-item>										
							</el-form>
						</div>		
						<div v-if="el.type==3">
							<el-form ref="el" :model="el" label-width="80px">
								<el-form-item  label="问题:">
									{{el.question}}<span style="color: red;float: right;">(满分{{el.score}}分)</span>
								</el-form-item>
								<el-form-item ref="el" label="回答:" :model="el" >
								    <el-checkbox-group v-model="el.correctAnswer" >
								      <el-checkbox label="A" :disabled="role!='student'||stupass">{{el.optionA}}</el-checkbox></br>
								      <el-checkbox label="B" :disabled="role!='student'||stupass">{{el.optionB}}</el-checkbox></br>
								      <el-checkbox label="C" :disabled="role!='student'||stupass">{{el.optionC}}</el-checkbox></br>
								      <el-checkbox label="D" :disabled="role!='student'||stupass">{{el.optionD}}</el-checkbox></br>
								      <el-checkbox v-if="el.optionE" label="E" :disabled="role!='student'||stupass">{{el.optionE}}</el-checkbox></br>
								      <el-checkbox v-if="el.optionF" label="F" :disabled="role!='student'||stupass">{{el.optionF}}</el-checkbox>
								    </el-checkbox-group>
								</el-form-item>	
								<el-form-item v-if="scoreShow" label="本题得分：" label-width="120px" style="color: red;">
									{{el.problemScore}}分
								</el-form-item>		
								<el-form-item v-if="scoreShow" label="正确答案：" label-width="120px" style="color: red;">
									{{el.correctAnswer}}
								</el-form-item>										
							</el-form>
						</div>		
						<div v-if="el.type==4">
							<el-form ref="el" :model="el" label-width="80px">
								<el-form-item  label="问题:">
									{{el.question}}<span style="color: red;float: right;">(满分{{el.score}}分)</span>
								</el-form-item>
								<el-form-item ref="el" label="回答:" :model="el" >
						    	    <el-radio-group v-model="el.correctAnswer" size="medium" :disabled="role!='student'||stupass" >
								      <el-radio label="1" value="">正确</el-radio>
								      <el-radio label="0" value="">错误</el-radio>
								    </el-radio-group>
								</el-form-item>		
								<el-form-item  v-if="scoreShow" label="本题得分：" label-width="120px" style="color: red;">
									{{el.problemScore}}分
								</el-form-item>		
								<el-form-item v-if="scoreShow" label="正确答案：" label-width="120px" style="color: red;">
									{{el.correctAnswer==1?'正确':'错误'}}
								</el-form-item>											
							</el-form>
						</div>						
					</el-col>			
				</el-row>	
				<el-row :gutter="20" style="margin: 30px 0;" v-if="scoreShow">
					<h1 >小节总得分：<span style="color:red;">{{Stageinfo.unitScore}}分</span></h1>				
				</el-row>
						
			</el-col>
		</div>	
		<el-dialog  title="图纸" :append-to-body="true"  :modal="false" custom-class="prevdrawdislog" v-model="addFormVisible">
			<template >
				<dians v-if="drawingTypeId==2" :tochild="Drawdian" ref="dianss"></dians>
				<fenxi v-if="drawingTypeId==6" :tochild="Drawfenxi" ref="dianss"></fenxi>
				<lantu  v-if="drawingTypeId==3":tochild="Drawlantu" ref="dianss"></lantu>
				<shangye v-if="drawingTypeId==4" :tochild="Drawshangye" ref="dianss"></shangye>
				<yanjiang v-if="drawingTypeId==5" :tochild="Drawyanjiang" ref="dianss"></yanjiang>
				<tiyan v-if="drawingTypeId==1" :tochild="Drawtiyan" ref="dianss"></tiyan>
				<iframe v-show="drawingTypeId==7"  v-bind:src="'http://www.zcxy360.com/sandtable/naotu/index.html?use='+use" width="100%" height="1200px" id="naotu"></iframe>						
			</template>						
			<div slot="footer" class="dialog-footer">
				<el-button @click.native="addFormVisible = false">关闭</el-button>
				<el-button v-if="role=='student'&&teamRole=='ceo'" type="primary" @click.native="click">保存</el-button>			
			</div>				
		</el-dialog>			
	</section>
	
</template>

<script>
	import dian from '../draw/dian.vue';
	import fenxi from '../draw/fenxi.vue';
	import lantu from '../draw/lantu.vue';
	import shangye from '../draw/shangye.vue';
	import yanjiang from '../draw/yanjiang.vue';
	import tiyan from '../draw/tiyan.vue';
	export default {
	 	data(){
	 		return{
	 			activeName:"0",
	 			lookVisible:false,
	 			loading:false,
	 			Tuiloading:false,
	 			Roadloading:false,
	 			addFormVisible:false,
	 			path:"",
				Drawdian:{
					use:true,
					content:""
				},
				Drawfenxi:{
					use:true,
					content:""
				},
				Drawlantu:{
					use:true,
					content:""
				},
				Drawshangye:{
					use:true,
					content:""
				},
				Drawyanjiang:{
					use:true,
					content:""
				},
				Drawtiyan:{
					use:true,
					content:""
				},
				Drawnaotu:{
					use:true,
					content:""
				},			
	 			drawingTypeId:"",
	 			role:"",
	 			answerJson:[],
	 			stuquestion:[],
	 			stupass:false,
	 			scoreShow:false,
	 		}
	 	},
		props:['tochild'],
	 	components:{'dians':dian,'fenxi':fenxi,'lantu':lantu,'shangye':shangye,'yanjiang':yanjiang,'tiyan':tiyan},		
	 	methods:{
			showDislog:function(el){
				if(el.drawingTypeId=='1'){
					this.Drawtiyan.content=el.content;
				}
				if(el.drawingTypeId=='2'){
					this.Drawdian.content=JSON.parse(el.content);
				}
				if(el.drawingTypeId=='3'){
					this.Drawlantu.content=JSON.parse(el.content);
				}
				if(el.drawingTypeId=='4'){
					this.Drawshangye.content=JSON.parse(el.content);
				}	
				if(el.drawingTypeId=='5'){
					this.Drawyanjiang.content=JSON.parse(el.content);
				}	
				if(el.drawingTypeId=='6'){
					this.Drawfenxi.content=JSON.parse(el.content);
				}		
				if(el.drawingTypeId=='7'){
					this.use=0;						
					localStorage.setItem('Drawnaotu',el.content);		
				}		
				this.drawingTypeId=el.drawingTypeId;
				this.addFormVisible=true;
				$('.v-modal').remove()
			},	
	 	},
		mounted() {
			var _this=this;
			$.each(_this.tochild.problems, function(e,value) {
				if(value.type==3){
					value.correctAnswer=value.correctAnswer.split(',')
				}
			});
			
		}  	 	
	 }
</script>
<style scoped src='../../../static/css/style.css'>
</style>
<style type="text/css">
	.prevdrawdislog{
		width:100%;
		top: 0 !important;
		overflow: scroll;
		z-index: 99999999;
	}

</style>